<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<script type="text/javascript" src="${pageContext.request.contextPath }/script/jquery-ui-1.9.2.custom.js"></script>
<link type="text/css" rel="stylesheet"
	href="${pageContext.request.contextPath }/css/ui-lightness/jquery-ui-1.9.2.custom.css" />
<script>
	$(function(){
		$("#btnSearch").click(function(){
			location.href="list?title="+$("#keyword").val()+"&genreId="+$("#gid").val();
		});
		$("#keyword").autocomplete({
			source:function(request,callback){
				$.ajax({
					url:"tips",
					data:{title:request.term},
					dataType:"json",
					type:"GET",
					success:function(json){
						callback(json);
					}
				})
			}
		});
	});
</script>
<div id="header">
	<div id="header-logo">
		<a href="index.jsp"><img
			src="${pageContext.request.contextPath }/style/images/logo.png"
			alt=""></img></a>
	</div>
	<div id="header-login">
		<a href="loginAction">登录</a> | <a href="registerAction">注册</a>
	</div>
	<div class="clearBoth"></div>
	<div id="header-search">
		<input type="hidden" value="${genreId }" id="gid"/>
		<input id="keyword" type="text" name="title" value="${title }"/><input id="btnSearch"
			type="button" value="搜索" />
	</div>
	<div id="header-nav">
		<ul>
			<li><a href="index">首页</a></li>
			<li><a href="#">商店</a></li>
			<li><a href="shoppingCart">购物车</a></li>
			<li><a href="#">个人信息</a></li>
			<c:if test="${not empty user.username && user.userRoleId ==2}">
				<li><a href="admin/backstage">后台管理</a></li>
			</c:if> 
		</ul>
		<label id="welcome">您好,
			 <c:if test="${not empty user.username}">
				${user.username }
			</c:if>
			<c:if test="${empty user.username }">
				游客
			</c:if> 
		</label>
	</div>
</div>